const { defineConfig } = require('@vue/cli-service');
let Mock=require("mockjs");
let data=Mock.mock({
  "list|10":[
    {
      "img":"@Image('100x100',@color)",
      "title":"@ctitle(2)",
      "name":"@cword(5)",
      "price|100-1000":100
    }
  ]
})
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false,
  devServer: {
    onAfterSetupMiddleware: function (devServer) {
      if (!devServer) {
        throw new Error('webpack-dev-server is not defined');
      }

      devServer.app.get('/lists', function (req, res) {
        res.json(data.list);
      });
    },
  },

})
